import http from '@/http/index';
import type { Result } from '@/http/type';
import type { DeviceStackerCraneTransportationFee, DeviceStackerCraneTransportationFeeQuery, DeviceStackerCraneTransportationFeeVo } from './type';

const api = {
  list: '/api/device-stacker-crane-transportation-fee/page',
  detail: '/api/device-stacker-crane-transportation-fee',
  add: '/api/device-stacker-crane-transportation-fee',
  update: '/api/device-stacker-crane-transportation-fee',
  delete: '/api/device-stacker-crane-transportation-fee',
  findByWeightAndHeight: '/api/device-stacker-crane-transportation-fee/findByWeightAndHeight',
};

/**
 * 分页查询堆垛机运输费
 * @param params 查询参数
 */
export function getDeviceStackerCraneTransportationFeeList(params: DeviceStackerCraneTransportationFeeQuery) {
  return http.get<Result<any>>(api.list, params);
}

/**
 * 获取堆垛机运输费详情
 * @param id 堆垛机运输费ID
 */
export function getDeviceStackerCraneTransportationFeeDetail(id: number | string) {
  return http.get<Result<DeviceStackerCraneTransportationFee>>(`${api.detail}/${id}`);
}

/**
 * 新增堆垛机运输费
 * @param data 堆垛机运输费数据
 */
export function addDeviceStackerCraneTransportationFee(data: DeviceStackerCraneTransportationFee) {
  return http.post<Result<boolean>>(api.add, data);
}

/**
 * 更新堆垛机运输费
 * @param data 堆垛机运输费数据
 */
export function updateDeviceStackerCraneTransportationFee(data: DeviceStackerCraneTransportationFee) {
  return http.put<Result<boolean>>(api.update, data);
}

/**
 * 删除堆垛机运输费
 * @param id 堆垛机运输费ID
 */
export function deleteDeviceStackerCraneTransportationFee(id: number | string) {
  return http.delete<Result<boolean>>(`${api.delete}/${id}`);
}

/**
 * 根据重量和高度查找匹配的运输费
 * @param data 查询条件
 */
export function findDeviceStackerCraneTransportationFeeByWeightAndHeight(data: DeviceStackerCraneTransportationFeeVo) {
  return http.post<Result<DeviceStackerCraneTransportationFee>>(api.findByWeightAndHeight, data);
} 